package com.p2p.front.service.impl;

import java.util.Date;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.p2p.front.dal.dao.ChargeLogDao;
import com.p2p.front.dal.model.ChargeLog;
import com.p2p.front.enums.ChargeLogStatus;
import com.p2p.front.service.ChargeLogService;
import com.p2p.front.service.ChargeLogSummaryService;

/**
 * leiwen@yiqihao.com
 */
@Service("chargeLogService")
public class ChargeLogServiceImpl implements ChargeLogService {

	@Resource
	private ChargeLogDao chargeLogDao;
	@Resource
	private ChargeLogSummaryService chargeLogSummaryService;
	

	public void add(ChargeLog chargeLog){
		chargeLogDao.add(chargeLog);
	}
	
	public void updateSucceed(ChargeLog chargeLog){
		chargeLog.setStatus(ChargeLogStatus.SUCCEED.getCode());
		chargeLogDao.updateStatusSucceed(chargeLog);
		chargeLogSummaryService.update(chargeLog);
	}
	
	public void updateFailed(ChargeLog chargeLog){
		chargeLog.setStatus(ChargeLogStatus.FAILED.getCode());
		chargeLogDao.updateStatusFailed(chargeLog);
	}
}
